{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# Merge multiple well data files(多个井数据文件合并)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "Prevent multiple well data files from being stored in one CSV file(将多口井数据文件防止到一个csv文件中)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "import math\n",
    "# import seaborn as sns\n",
    "# import pylab as pl\n",
    "\n",
    "# from mpl_toolkits.axes_grid1 import make_axes_locatable\n",
    "# from scipy import interpolate\n",
    "from pandas import set_option\n",
    "set_option(\"display.max_rows\", 15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 使用GPU训练时候，打开下面注释\n",
    "import os\n",
    "# os.environ['CUDA_VISIBLE_DEVICES']='0'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# Set the types of curves to be included in the merged results(设定要合并结果中包含的曲线种类)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 定义要处理的常规测井资料\n",
    "# usual_log_names = [\"AC\",\"CNL\",\"DEN\",\"GR\",\"RD\",\"RS\"]\n",
    "# usual_log_names = [\"DT\",\"CNL\",\"DEN\",\"GR\",\"RD\",\"RS\",'DTXX']\n",
    "usual_log_names = [\"CAL\",\"SP\",\"GR\",\"CNL\",\"DT\",\"DEN\",\"MSFL\",\"RS\",\"RD\"]\n",
    "\n",
    "# 定义是否要使用常规测井资料，True | False\n",
    "use_usual_log = True\n",
    "use_custom_depth = False\n",
    "merge_mode = \"Up_Down\"  # default:Left-Right  | Up_Down"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# Loading Data读入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "['facies_data', 'train', '地质4口卡奔图-1-58']\n",
      "结果文件名：地质4口卡奔图-1-58_all.csv\n",
      "\n",
      "结果文件完整路径：facies_data/train/\n",
      "\n"
     ]
    }
   ],
   "source": [
    "\n",
    "result_data_path = '../data/exp_curve_reconstract/exp_2/train/QSK/'\n",
    "# filename 取值例如：'TT1-3085m-5078m.csv','J404-3394m-4257m.csv'\n",
    "file_path_list = []\n",
    "all_result_csvfile_name = \"\"#'TT1-4500m-5070m_R_0.1524.csv'\n",
    "# all_result_save_path = 'csv_results/汇总/'\n",
    "all_result_save_path = '../data/exp_curve_reconstract/exp_2/train/QSK/'\n",
    "print(all_result_csvfile_name)\n",
    "for parent, dirnames, filenames in os.walk(result_data_path,  followlinks=True):\n",
    "    # print(filenames)\n",
    "    for filename in filenames:\n",
    "        file_path = os.path.join(parent, filename)\n",
    "        file_path_list.append(file_path)\n",
    "    print(str(parent).rstrip(\"/\").split(\"/\"))\n",
    "        # print(os.path.dirname(parent))\n",
    "        # all_result_csvfile_name = parent.split(\"/\")[-1] + '_all_result.csv'\n",
    "    all_result_csvfile_name = str(parent).rstrip(\"/\").split(\"/\")[-1] + '_all.csv'\n",
    "        # print('文件名：%s' % filename)\n",
    "        # print('文件完整路径：%s\\n' % file_path)\n",
    "print('结果文件名：%s\\n' % all_result_csvfile_name)\n",
    "print('结果文件完整路径：%s\\n' % all_result_save_path)\n",
    "#原文链接：https://blog.csdn.net/huplion/article/details/79537334"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['facies_data/train/地质4口卡奔图-1-58/古页-1_facies_vectors_0.1.csv',\n",
       " 'facies_data/train/地质4口卡奔图-1-58/英斜-58井_facies_vectors_0.1.csv']"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "file_path_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPTH</th>\n",
       "      <th>CAL</th>\n",
       "      <th>SP</th>\n",
       "      <th>GR</th>\n",
       "      <th>CNL</th>\n",
       "      <th>DT</th>\n",
       "      <th>DEN</th>\n",
       "      <th>MSFL</th>\n",
       "      <th>RS</th>\n",
       "      <th>RD</th>\n",
       "      <th>Well Name</th>\n",
       "      <th>Facies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2304.5</td>\n",
       "      <td>10.8180</td>\n",
       "      <td>102.90</td>\n",
       "      <td>128.0</td>\n",
       "      <td>18.60</td>\n",
       "      <td>96.0</td>\n",
       "      <td>2.4600</td>\n",
       "      <td>2.170</td>\n",
       "      <td>10.020</td>\n",
       "      <td>9.440</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2304.6</td>\n",
       "      <td>10.7556</td>\n",
       "      <td>102.66</td>\n",
       "      <td>128.0</td>\n",
       "      <td>19.00</td>\n",
       "      <td>96.8</td>\n",
       "      <td>2.4600</td>\n",
       "      <td>2.034</td>\n",
       "      <td>9.548</td>\n",
       "      <td>9.040</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2304.7</td>\n",
       "      <td>10.7130</td>\n",
       "      <td>102.42</td>\n",
       "      <td>128.6</td>\n",
       "      <td>19.58</td>\n",
       "      <td>97.0</td>\n",
       "      <td>2.4582</td>\n",
       "      <td>2.006</td>\n",
       "      <td>9.118</td>\n",
       "      <td>8.664</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2304.8</td>\n",
       "      <td>10.7442</td>\n",
       "      <td>102.22</td>\n",
       "      <td>129.0</td>\n",
       "      <td>20.30</td>\n",
       "      <td>97.0</td>\n",
       "      <td>2.4546</td>\n",
       "      <td>2.086</td>\n",
       "      <td>8.778</td>\n",
       "      <td>8.364</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2304.9</td>\n",
       "      <td>10.8426</td>\n",
       "      <td>102.10</td>\n",
       "      <td>128.8</td>\n",
       "      <td>21.06</td>\n",
       "      <td>97.0</td>\n",
       "      <td>2.4488</td>\n",
       "      <td>2.242</td>\n",
       "      <td>8.546</td>\n",
       "      <td>8.160</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2816</th>\n",
       "      <td>2586.1</td>\n",
       "      <td>8.7800</td>\n",
       "      <td>98.60</td>\n",
       "      <td>152.2</td>\n",
       "      <td>17.56</td>\n",
       "      <td>93.8</td>\n",
       "      <td>2.6162</td>\n",
       "      <td>5.766</td>\n",
       "      <td>5.492</td>\n",
       "      <td>4.482</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2817</th>\n",
       "      <td>2586.2</td>\n",
       "      <td>8.7800</td>\n",
       "      <td>98.54</td>\n",
       "      <td>149.0</td>\n",
       "      <td>17.02</td>\n",
       "      <td>91.2</td>\n",
       "      <td>2.6242</td>\n",
       "      <td>7.284</td>\n",
       "      <td>5.734</td>\n",
       "      <td>4.746</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2818</th>\n",
       "      <td>2586.3</td>\n",
       "      <td>8.7796</td>\n",
       "      <td>98.50</td>\n",
       "      <td>145.0</td>\n",
       "      <td>16.38</td>\n",
       "      <td>89.2</td>\n",
       "      <td>2.6346</td>\n",
       "      <td>8.520</td>\n",
       "      <td>5.994</td>\n",
       "      <td>5.014</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2819</th>\n",
       "      <td>2586.4</td>\n",
       "      <td>8.7790</td>\n",
       "      <td>98.46</td>\n",
       "      <td>141.2</td>\n",
       "      <td>15.80</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6448</td>\n",
       "      <td>8.676</td>\n",
       "      <td>6.204</td>\n",
       "      <td>5.222</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2820</th>\n",
       "      <td>2586.5</td>\n",
       "      <td>8.7790</td>\n",
       "      <td>98.30</td>\n",
       "      <td>138.0</td>\n",
       "      <td>15.40</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6520</td>\n",
       "      <td>7.140</td>\n",
       "      <td>6.300</td>\n",
       "      <td>5.310</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2821 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       DEPTH      CAL      SP     GR    CNL    DT     DEN   MSFL      RS  \\\n",
       "0     2304.5  10.8180  102.90  128.0  18.60  96.0  2.4600  2.170  10.020   \n",
       "1     2304.6  10.7556  102.66  128.0  19.00  96.8  2.4600  2.034   9.548   \n",
       "2     2304.7  10.7130  102.42  128.6  19.58  97.0  2.4582  2.006   9.118   \n",
       "3     2304.8  10.7442  102.22  129.0  20.30  97.0  2.4546  2.086   8.778   \n",
       "4     2304.9  10.8426  102.10  128.8  21.06  97.0  2.4488  2.242   8.546   \n",
       "...      ...      ...     ...    ...    ...   ...     ...    ...     ...   \n",
       "2816  2586.1   8.7800   98.60  152.2  17.56  93.8  2.6162  5.766   5.492   \n",
       "2817  2586.2   8.7800   98.54  149.0  17.02  91.2  2.6242  7.284   5.734   \n",
       "2818  2586.3   8.7796   98.50  145.0  16.38  89.2  2.6346  8.520   5.994   \n",
       "2819  2586.4   8.7790   98.46  141.2  15.80  88.0  2.6448  8.676   6.204   \n",
       "2820  2586.5   8.7790   98.30  138.0  15.40  88.0  2.6520  7.140   6.300   \n",
       "\n",
       "         RD  Well Name  Facies  \n",
       "0     9.440          1       3  \n",
       "1     9.040          1       3  \n",
       "2     8.664          1       3  \n",
       "3     8.364          1       3  \n",
       "4     8.160          1       3  \n",
       "...     ...        ...     ...  \n",
       "2816  4.482          1       2  \n",
       "2817  4.746          1       2  \n",
       "2818  5.014          1       2  \n",
       "2819  5.222          1       2  \n",
       "2820  5.310          1       2  \n",
       "\n",
       "[2821 rows x 12 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "depth_data = pd.read_csv(file_path_list[0],engine='python',encoding='GBK')\n",
    "depth_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# if use_custom_depth == False:\n",
    "#     pd_data = None     \n",
    "# else:\n",
    "#     pd_data = pd.DataFrame(depth_data,columns=[\"DEPTH\"])\n",
    "# pd_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "pd_data = None   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "for item_file in file_path_list:\n",
    "    item_data = pd.read_csv(item_file,engine='python',encoding='GBK')\n",
    "    # pd_data1 = item_data.iloc[:,1:]\n",
    "    pd_data1 = item_data\n",
    "    if merge_mode == \"Up_Down\":\n",
    "        # 选择合并方式\n",
    "        pd_data =pd.concat([pd_data,pd_data1],axis=0,ignore_index=True)\n",
    "    else:\n",
    "        pd_data =pd.concat([pd_data,pd_data1],axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPTH</th>\n",
       "      <th>CAL</th>\n",
       "      <th>SP</th>\n",
       "      <th>GR</th>\n",
       "      <th>CNL</th>\n",
       "      <th>DT</th>\n",
       "      <th>DEN</th>\n",
       "      <th>MSFL</th>\n",
       "      <th>RS</th>\n",
       "      <th>RD</th>\n",
       "      <th>Well Name</th>\n",
       "      <th>Facies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2304.5</td>\n",
       "      <td>10.8180</td>\n",
       "      <td>102.9000</td>\n",
       "      <td>128.0000</td>\n",
       "      <td>18.6000</td>\n",
       "      <td>96.0000</td>\n",
       "      <td>2.4600</td>\n",
       "      <td>2.1700</td>\n",
       "      <td>10.0200</td>\n",
       "      <td>9.4400</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2304.6</td>\n",
       "      <td>10.7556</td>\n",
       "      <td>102.6600</td>\n",
       "      <td>128.0000</td>\n",
       "      <td>19.0000</td>\n",
       "      <td>96.8000</td>\n",
       "      <td>2.4600</td>\n",
       "      <td>2.0340</td>\n",
       "      <td>9.5480</td>\n",
       "      <td>9.0400</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2304.7</td>\n",
       "      <td>10.7130</td>\n",
       "      <td>102.4200</td>\n",
       "      <td>128.6000</td>\n",
       "      <td>19.5800</td>\n",
       "      <td>97.0000</td>\n",
       "      <td>2.4582</td>\n",
       "      <td>2.0060</td>\n",
       "      <td>9.1180</td>\n",
       "      <td>8.6640</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2304.8</td>\n",
       "      <td>10.7442</td>\n",
       "      <td>102.2200</td>\n",
       "      <td>129.0000</td>\n",
       "      <td>20.3000</td>\n",
       "      <td>97.0000</td>\n",
       "      <td>2.4546</td>\n",
       "      <td>2.0860</td>\n",
       "      <td>8.7780</td>\n",
       "      <td>8.3640</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2304.9</td>\n",
       "      <td>10.8426</td>\n",
       "      <td>102.1000</td>\n",
       "      <td>128.8000</td>\n",
       "      <td>21.0600</td>\n",
       "      <td>97.0000</td>\n",
       "      <td>2.4488</td>\n",
       "      <td>2.2420</td>\n",
       "      <td>8.5460</td>\n",
       "      <td>8.1600</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3908</th>\n",
       "      <td>2121.0</td>\n",
       "      <td>8.6860</td>\n",
       "      <td>167.7170</td>\n",
       "      <td>138.9920</td>\n",
       "      <td>19.5630</td>\n",
       "      <td>91.9960</td>\n",
       "      <td>2.5790</td>\n",
       "      <td>6.6650</td>\n",
       "      <td>5.4110</td>\n",
       "      <td>4.8130</td>\n",
       "      <td>X58</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3909</th>\n",
       "      <td>2121.1</td>\n",
       "      <td>8.7100</td>\n",
       "      <td>167.8194</td>\n",
       "      <td>133.5352</td>\n",
       "      <td>19.7814</td>\n",
       "      <td>89.8688</td>\n",
       "      <td>2.5622</td>\n",
       "      <td>6.2690</td>\n",
       "      <td>5.7942</td>\n",
       "      <td>5.1658</td>\n",
       "      <td>X58</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3910</th>\n",
       "      <td>2121.2</td>\n",
       "      <td>8.7220</td>\n",
       "      <td>167.7712</td>\n",
       "      <td>126.5028</td>\n",
       "      <td>19.7904</td>\n",
       "      <td>87.2976</td>\n",
       "      <td>2.5448</td>\n",
       "      <td>7.2152</td>\n",
       "      <td>6.4504</td>\n",
       "      <td>5.7964</td>\n",
       "      <td>X58</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3911</th>\n",
       "      <td>2121.3</td>\n",
       "      <td>8.7248</td>\n",
       "      <td>167.6516</td>\n",
       "      <td>120.2804</td>\n",
       "      <td>19.4012</td>\n",
       "      <td>84.6108</td>\n",
       "      <td>2.5292</td>\n",
       "      <td>10.1568</td>\n",
       "      <td>7.3772</td>\n",
       "      <td>6.7212</td>\n",
       "      <td>X58</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3912</th>\n",
       "      <td>2121.4</td>\n",
       "      <td>8.7214</td>\n",
       "      <td>167.5582</td>\n",
       "      <td>116.5122</td>\n",
       "      <td>18.5996</td>\n",
       "      <td>82.2284</td>\n",
       "      <td>2.5176</td>\n",
       "      <td>14.1060</td>\n",
       "      <td>8.4930</td>\n",
       "      <td>7.8698</td>\n",
       "      <td>X58</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3913 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       DEPTH      CAL        SP        GR      CNL       DT     DEN     MSFL  \\\n",
       "0     2304.5  10.8180  102.9000  128.0000  18.6000  96.0000  2.4600   2.1700   \n",
       "1     2304.6  10.7556  102.6600  128.0000  19.0000  96.8000  2.4600   2.0340   \n",
       "2     2304.7  10.7130  102.4200  128.6000  19.5800  97.0000  2.4582   2.0060   \n",
       "3     2304.8  10.7442  102.2200  129.0000  20.3000  97.0000  2.4546   2.0860   \n",
       "4     2304.9  10.8426  102.1000  128.8000  21.0600  97.0000  2.4488   2.2420   \n",
       "...      ...      ...       ...       ...      ...      ...     ...      ...   \n",
       "3908  2121.0   8.6860  167.7170  138.9920  19.5630  91.9960  2.5790   6.6650   \n",
       "3909  2121.1   8.7100  167.8194  133.5352  19.7814  89.8688  2.5622   6.2690   \n",
       "3910  2121.2   8.7220  167.7712  126.5028  19.7904  87.2976  2.5448   7.2152   \n",
       "3911  2121.3   8.7248  167.6516  120.2804  19.4012  84.6108  2.5292  10.1568   \n",
       "3912  2121.4   8.7214  167.5582  116.5122  18.5996  82.2284  2.5176  14.1060   \n",
       "\n",
       "           RS      RD Well Name  Facies  \n",
       "0     10.0200  9.4400         1       3  \n",
       "1      9.5480  9.0400         1       3  \n",
       "2      9.1180  8.6640         1       3  \n",
       "3      8.7780  8.3640         1       3  \n",
       "4      8.5460  8.1600         1       3  \n",
       "...       ...     ...       ...     ...  \n",
       "3908   5.4110  4.8130       X58       3  \n",
       "3909   5.7942  5.1658       X58       6  \n",
       "3910   6.4504  5.7964       X58       6  \n",
       "3911   7.3772  6.7212       X58       6  \n",
       "3912   8.4930  7.8698       X58       6  \n",
       "\n",
       "[3913 rows x 12 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# Writing data to csv(结果写入csv)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "pd_data.to_csv(all_result_save_path + all_result_csvfile_name,index = False,encoding='GBK',header=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Finished!!\n",
      "facies_data/train/地质4口卡奔图-1-58_all.csv\n"
     ]
    }
   ],
   "source": [
    "print(\"Finished!!\")\n",
    "print(str(all_result_save_path) + str(all_result_csvfile_name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "python310",
   "language": "python",
   "display_name": "Python 310 (ipykernel)"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "256px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}